Skip to content

fix: bind hash-path attribution memos to challenge IDs#190

Open
brendanjryan wants to merge 4 commits intomainfrom
fix/challenge-bound-hash-memo
Open

fix: bind hash-path attribution memos to challenge IDs#190
brendanjryan wants to merge 4 commits intomainfrom
fix/challenge-bound-hash-memo

Conversation

@brendanjryan
Copy link
Copy Markdown
Collaborator

@brendanjryan brendanjryan commented Apr 3, 2026

@brendanjryan brendanjryan added the cyclops Trigger Cyclops PR audit label Apr 3, 2026
@brendanjryan brendanjryan force-pushed the fix/challenge-bound-hash-memo branch from 81c330f to 7319ccc Compare April 3, 2026 02:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

⚠️ Changelog not found.

A changelog entry is required before merging. We've generated a suggested changelog based on your changes:

Preview
---
mpp: minor
---

Replaced random nonces in attribution memos with deterministic challenge-bound nonces derived from `keccak256(challenge_id)`, making memos verifiable per-challenge. Added `verify_challenge_binding` to the attribution module and enforced memo-to-challenge binding during Tempo hash-path payment verification. Also fixed empty memo strings being treated as present across `TempoMethodDetails`, `ChargeRequest`, and memo parsing.

Add changelog to commit this to your branch.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 81c330f9f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +561 to +563
if charge.memo().is_none() {
assert_challenge_bound_memo(&matched_logs, challenge_id, realm)?;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve hash-path payments from pre-binding clients

This new guard rejects every hash-path payment without an explicitly requested memo unless at least one matched log contains a challenge-bound MPP memo. That breaks mixed-version deployments: older clients generated random attribution memos (not challenge.id-bound), so otherwise valid receipts now fail with memo is not bound to this challenge as soon as servers upgrade. Consider a compatibility path (e.g., temporary legacy memo acceptance or version-gated enforcement) so rolling upgrades do not hard-fail existing clients.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is intentional for hash based flows, which are not a common path


/// Encodes an MPP attribution memo as a 32-byte array.
pub fn encode(server_id: &str, client_id: Option<&str>) -> [u8; 32] {
pub fn encode(challenge_id: &str, server_id: &str, client_id: Option<&str>) -> [u8; 32] {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid breaking the public attribution API in a patch

Changing mpp::tempo::attribution::encode to require challenge_id is a source-compatible break for downstream users calling this public API, and encode_hex was changed similarly. Shipping this as a patch means consumers can pick up the update and hit compile failures unexpectedly; a backward-compatible wrapper/deprecation path (or a compatibility-level bump) is needed to prevent that breakage.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is ok given maturity of this package

@tempoxyz-bot
Copy link
Copy Markdown

👁️ Cyclops Security Review

70ca23d

🧭 Auditing · mode=normal · workers 0/3 done (3 left) · verify pending 0

Worker Engine Progress Status
pr-190-w1 gemini-3.1-pro-preview · · · Running
pr-190-w2 amp/deep · · · Running
pr-190-w3 gpt-5.4 · · · Running
⚙️ Controls
  • 🚀 Keep only 1 remaining iteration per worker after the current work finishes.
  • 👀 Keep only 2 remaining iterations per worker after the current work finishes.
  • ❤️ Let only worker 1 continue; other workers skip queued iterations.
  • 😄 Let only worker 2 continue; other workers skip queued iterations.
  • 🎉 End faster by skipping queued iterations and moving toward consolidation.
  • 😕 Stop active workers/verifiers now and start consolidation immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cyclops Trigger Cyclops PR audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants